//
//  AlbumTabbar.m
//  ProjectSource_Demo
//
//  Created by Liu on 16/2/2.
//  Copyright © 2016年 AngryBear. All rights reserved.
//

#import "AlbumTabbar.h"

@implementation AlbumTabbar


- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self addSubview:self.previewButton];
        [self addSubview:self.sendButton];
        [self addSubview:self.line];
        
        [self.previewButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(@20);
            make.centerY.equalTo(self);
        }];
        
        [self.sendButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self).with.offset(-5);
            make.height.mas_equalTo(@36);
            make.centerY.equalTo(self);
        }];
        
        [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.and.right.and.top.mas_equalTo(0);
            make.height.mas_equalTo(@0.5);
        }];
    }
    return self;
}

#pragma mark - Property Methods
- (UIImageView *)line
{
    if (!_line) {
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectZero];
        imageView.backgroundColor = [UIColor graylineColor];
        _line = imageView;
    }
    return _line;
}
- (UIButton *)previewButton
{
    if (!_previewButton) {
        UIButton *button = [[UIButton alloc] initWithFrame:CGRectZero];
        button.backgroundColor = [UIColor clearColor];
        [button setTitleColor:[UIColor colorWithHexRGB:0x666666] forState:UIControlStateNormal];
        [button setTitle:@"预览" forState:UIControlStateNormal];
        button.titleLabel.font = [UIFont systemFontOfSize:18];
        _previewButton = button;
    }
    return _previewButton;
}

- (UIButton *)sendButton
{
    if (!_sendButton) {
        UIButton *button = [[UIButton alloc] initWithFrame:CGRectZero];
        button.backgroundColor = [UIColor appStyleColor];
        [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [button setTitle:@"  发送  " forState:UIControlStateNormal];
        button.titleLabel.font = [UIFont systemFontOfSize:15];
        button.layer.cornerRadius = 4.0f;
        button.layer.masksToBounds = YES;
        _sendButton = button;
    }
    return _sendButton;
}

@end
